package com.kakame.codenews.base.util;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

/**
 * <pre>
 * <b>desc:</b> 发送邮件的工具类 
 * <b>auth:</b> ex-hejm
 * <b>date:</b> 2018年6月8日 下午4:50:51
 * </pre>
 */
public class EmailUtil {
    public static void sendSimpleEmail(){
        JavaMailSender mailSender = SpringUtil.getBean("mailSender", JavaMailSender.class);
        SimpleMailMessage message = new SimpleMailMessage();//消息构造器
        message.setFrom("15086701981@163.com");//发件人
        message.setTo("903441294@qq.com");//收件人
        message.setSubject("Spring Email Test");//主题
        message.setText("hello world!!");//正文
        mailSender.send(message);
        System.out.println("邮件发送完毕");
    }
}
